<template>
	<view>
		<button @click="onSetTimeCall">单次定时器setTimeout</button>
		<button @click="onSetTimeCallxy(name,password)">带参数setTimeout</button>
		<button @click="onTimeoutClear(name,password)">取消</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:"lwh",
				password:'666',
				
			}
		},
		methods: {
			onSetTimeCall(){
				console.log("onSetTimeCall-->");
				// setTimeout
				setTimeout(()=>{
					//延时之后要执行的代码
					console.log("我延时3秒才会打印");
				},3000)
			},
			onSetTimeCallxy(name,pwd){
				console.log("onSetTimeCallxy--> name:"+name+",pwd:"+pwd);
				setTimeout((x,y)=>{
					console.log("我可以传参数了> x:"+x+",y:"+y);
				},2000, name, pwd)
			},
			onTimeoutClear(){
				console.log();
				clearTimeout(this.timeoutID);
			}
		}
	}
</script>

<style>

</style>
